[XNA] Forming bounding box only around visible sprites

Posted by nadalian on Stack Overflow See other posts from Stack Overflow or by nadalian
Published on 2010-12-29T03:45:21Z Indexed on 2010/12/29 3:54 UTC
Read the original article Hit count: 159

Filed under:
|
|

Hi, this site has been really amazing for helping me with game development however I'm unable to find an answer for the following question (nor am I able to solve it on my own).

I am trying to do rectangle collision in my game. My idea is to 1) get the original collision bounding rectangle 2) Transform the texture (pos/rot/scale) 3) Factor changes of item into a matrix and then use this matrix to change the original collision bounds of the item.

However, my textures contain a lot of transparency, transparency that affect the overall height/width of the texture (I do this to maintain power of two dimensions).

My problem: How to create a rectangle that forms dimensions which ignore transparency around the object. A picture is provided below:

http://img51.imageshack.us/img51/4772/boundingbox.png

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET